#pragma once

#ifdef WIN32
#include "WindowsIncludes.h"
#endif
#include "Globals.h"
#include "RakPeerInterface.h"
#include "NetworkIDManager.h"
#include "RPC3.h"

namespace game_engine
{

enum NETWORK_ID_OBJECT {
    LEVEL_ID        =   0,
    PLAYER_SCORE_ID =   1,
    ENEMY_SCORE_ID  =   2,
    NETPLAYER_AVATAR_ID =   3,
};

/*!
 * \class NetworkManager
 * \brief 
 */
class NetworkManager
{
///////////////////////////////////////////////////////////////////////////////
// Attribute definition
///////////////////////////////////////////////////////////////////////////////
private:
    static bool instanceFlag;
    static NetworkManager *instance;

    RakNet::RakPeerInterface *rakPeer;
    RakNet::NetworkIDManager networkIDManager;
    RakNet::RPC3 *rpc3Inst;

///////////////////////////////////////////////////////////////////////////////
// Method definition
///////////////////////////////////////////////////////////////////////////////
public:
    // Constructors and destructors
    virtual ~NetworkManager(void);

    // Others
    void initialize(const BOOL isServer) throw(...);
    void update(void) throw(...);

    // Getters
    static NetworkManager* getInstance(void);
    RakNet::NetworkIDManager& getNetworkIDManager(void);
    RakNet::RPC3* getRpc3Inst(void);

private:
    NetworkManager(void);

};

}
